package org.apm.data.delete;

import org.apm.data.bean.ScrollBean;
import org.elasticsearch.action.bulk.BulkProcessor;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.SearchHit;

public class DeleteScrollBean extends ScrollBean{

    public DeleteScrollBean(Client client, BulkProcessor bulkProcessor, String index, QueryBuilder query) {
        super(client, bulkProcessor, index, query);
    }

    @Override
    public void processData(SearchHit hit) {
        DeleteRequest delete = new DeleteRequest().index(hit.getIndex()).type(hit.getType()).id(hit.id());
        getBulkProcessor().add(delete);
    }
}
